# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: GreaterFire <GreaterFire at protonmail dot com>

pkgname=trojan
pkgver=1.16.0
pkgrel=10
pkgdesc="An unidentifiable mechanism that helps you bypass GFW"
arch=('loong64' 'x86_64')
url="https://github.com/trojan-gfw/trojan"
license=('GPL3')
depends=('boost-libs' 'openssl' 'mariadb-libs')
optdepends=('ca-certificates: server certificate verification'
            'mariadb: advanced user management')
makedepends=('cmake' 'boost' 'openssl' 'mariadb-libs')
checkdepends=('openssl' 'python' 'curl' 'netcat')
source=("$pkgname-$pkgver.tar.gz::https://github.com/trojan-gfw/$pkgname/archive/v$pkgver.tar.gz")
backup=('etc/trojan.json'
        'etc/trojan/config.json')
sha512sums=('60aa8539731eee6f15cbcb18b20b45435fc2dfe439a2f67fe9770257c3b6ffe219efe376cfd909f748d523a18645c96f6859b8487cacaba04ac7d93cf762f153')

build() {
  cd $pkgname-$pkgver
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
  make
}

check() {
  cd $pkgname-$pkgver
  ctest
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
}
